<?php
/**
 * Created by IDEA.
 * User: dinesh
 * Date: Aug 13, 2013
 * Time: 11:49:53 AM
 * To change this template use File | Settings | File Templates.
 */

class PrintController extends BaseController {

    function actionCheckResult() {
        $insId = $_REQUEST['institute'];
        $secId = $_REQUEST['section'];
        $fromMonth = $_REQUEST['month'];
        $fromYear = $_REQUEST['year'];
        $toMonth = $_REQUEST['toMonth'];
        $toYear = $_REQUEST['toYear'];
        $print = new PrintDistribution();
        $results = $print->checkResult($insId, $secId, $fromMonth, $fromYear, $toMonth, $toYear);
        if ($results) {

            $innerHtml = "<span style='color:green;font-size:25px;'>There are results</span>";
            $data = array('tableHtml' => $innerHtml, 'result' => true);
            echo json_encode($data);
        } else {
            $innerHtml = "<span style='color:red;font-size:25px;'>No Records Found on Selected Period !</span>";
            $data = array('tableHtml' => $innerHtml, 'result' => false);
            echo json_encode($data);
        }
    }

    function actionPrintDisList() {
        $insId = $_REQUEST['institute'];
        $secId = $_REQUEST['section'];
        $fromMonth = $_REQUEST['month'];
        $fromYear = $_REQUEST['year'];
        $toMonth = $_REQUEST['toMonth'];
        $toYear = $_REQUEST['toYear'];
        $print = new PrintDistribution();
        $print->AliasNbPages();
        $print->SetLeftMargin(20);
        $print->SetTopMargin(15);
        //$print->SetLeftMargin(20);
        //$print->SetFont('Arial','',12);
        $print->AddPage();
        $print->BasicTable($insId, $secId, $fromMonth, $fromYear, $toMonth, $toYear);
        // $print->printDistributionList($insId,$secId,$fromMonth,$fromYear,$toMonth,$toYear);
        $print->Output();

    }
}
